package com.hydra.cron.server.cron;

import com.hydra.cron.common.constants.C;
import com.hydra.cron.common.curator.helper.CuratorHelper;
import com.hydra.cron.common.utils.PathUtil;
import com.hydra.cron.server.cron.listener.SupportChildNodeListener;

import java.io.IOException;

/**
 * hdyraCron Created by ZhengGong on 15/12/28.
 * PackageName com.hydra.cron.server.cron
 * Description
 */
public class SupportManager {
    private void jobStartListener(String serverName, String jobKey) throws Exception {
        CuratorHelper.getInstance().watchChild(PathUtil.path(C.PATH.WORK_PATH, serverName, jobKey), new SupportChildNodeListener(PathUtil.path(C.PATH.WORK_PATH, serverName, jobKey)));
    }

    private void jobStopListener(String serverName, String jobKey) throws IOException {
        CuratorHelper.getInstance().removeWatchChild(PathUtil.path(C.PATH.WORK_PATH, serverName, jobKey));
    }
}
